package com.api.shopapi.service.impl;

import com.api.shopapi.entity.NursingSchedulingChangeRecord;
import com.api.shopapi.mapper.NursingSchedulingChangeRecordMapper;
import com.api.shopapi.service.NursingSchedulingChangeRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author maochuan
 */
@Service("NursingSchedulingChangeRecordServiceImplOne")
public class NursingSchedulingChangeRecordServiceImpl implements NursingSchedulingChangeRecordService {
    @Autowired
    private NursingSchedulingChangeRecordMapper nursingSchedulingChangeRecordMapper;


    @Override
    public int insert(NursingSchedulingChangeRecord nursingSchedulingChangeRecord) {
        return nursingSchedulingChangeRecordMapper.insert(nursingSchedulingChangeRecord);
    }

    @Override
    public NursingSchedulingChangeRecord getByNursingSchedulingChangeRecordCode(String nursingSchedulingChangeRecordCode) {
        return nursingSchedulingChangeRecordMapper.getByNursingSchedulingChangeRecordCode(nursingSchedulingChangeRecordCode);
    }

    @Override
    public PageInfo<NursingSchedulingChangeRecord> getPageList(int pageIndex, int pageSize, String institutionCode, String startTime, String endTime) {
        PageHelper.startPage(pageIndex, pageSize);
        List<NursingSchedulingChangeRecord> nursingSchedulingChangeRecordList = nursingSchedulingChangeRecordMapper.getPageList(institutionCode,startTime,endTime);
        PageInfo<NursingSchedulingChangeRecord> pageInfo = new PageInfo<>(nursingSchedulingChangeRecordList);
        return pageInfo;
    }
}
